package com.zhangln.mountbuzhou.mapper;

import com.zhangln.mountbuzhou.entity.TbConnectionLogEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;

/**
 * <p>
 * 客户端在线情况日志表 Mapper 接口
 * </p>
 *
 * @author sherry
 * @since 2020-04-27
 */
public interface TbConnectionLogMapper extends BaseMapper<TbConnectionLogEntity> {

    /**
     * 查询channelId最近一次连接情况
     *
     * @param channelId
     * @return
     */
    Long getMaxTbConnectionLogIdByChannelId(@Param("channelId") String channelId);

    /**
     * 查询一笔心跳
     *
     * @param channelId
     * @return
     */
    TbConnectionLogEntity getLastHeartPing(@Param("channelId") String channelId);

    /**
     * 更新一笔心跳检测时间
     *
     * @param id
     * @param updatedTime
     */
    void updateUpdatetimeById(@Param("id") Long id,@Param("updatedTime") LocalDateTime updatedTime);

    void truncate();
}
